<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateKabupatensTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('kabupatens', function(Blueprint $table) {
			$table->increments('id');
			$table->integer('provinsi_id')->unsigned()->index();
			$table->foreign('provinsi_id')->references('id')->on('provinsis')->onDelete('cascade');
			$table->string('nama');
			$table->text('keterangan')->nullable();
			$table->boolean('is_active')->default(1);
			$table->integer('user_id')->unsigned()->index();
			$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
			$table->integer('ref_id')->nullable()->unsigned();
			$table->char('action', 1)->default(1);
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('kabupatens');
	}

}
